#include "StdAfx.h"
#include "LoanAmountCalculatedModel.h"


CLoanAmountCalculatedModel::CLoanAmountCalculatedModel(void)
{
	m_id = 0;
	m_monthpayMultiple = 0;
	m_incomeMultiple = 0;
	m_sxxebs = 0;
	m_sxxeje = 0;
	m_maxLoan = 0;
	m_yfSxxeje = 0;
	m_yfMaxLoan = 0;
	m_wfMaxLoan = 0;
	m_sbBase = 0;
	m_orderNum = 0;
}

CLoanAmountCalculatedModel::~CLoanAmountCalculatedModel(void)
{
}

CString CLoanAmountCalculatedModel::getBankName()
{
	CString strName;
	strName = CUtils::convertChineseUnicodeToPyt(m_bankName);
	strName = strName.MakeUpper();
	strName += m_property;
	strName += m_limitTime;

	return strName;
}

void CLoanAmountCalculatedModel::parseFromJson(Json::Value& jsonData)
{
	CUtils::getJsonStringField(jsonData, "bankName", m_bankName);
	CUtils::getJsonStringField(jsonData, "property", m_property);
	CUtils::getJsonStringField(jsonData, "limitTime", m_limitTime);
	CUtils::getJsonStringField(jsonData, "hj", m_hj);
	CUtils::getJsonStringField(jsonData, "policyCompanyNames", m_policyCompanyNames);

	if (!jsonData["id"].isNull())
	{
		this->m_id = jsonData["id"].asInt();
	}
	if (!jsonData["monthpayMultiple"].isNull())
	{
		this->m_monthpayMultiple = jsonData["monthpayMultiple"].asInt();
	}
	if (!jsonData["incomeMultiple"].isNull())
	{
		this->m_incomeMultiple = jsonData["incomeMultiple"].asInt();
	}
	if (!jsonData["sxxebs"].isNull())
	{
		this->m_sxxebs = jsonData["sxxebs"].asInt();
	}
	if (!jsonData["sxxeje"].isNull())
	{
		this->m_sxxeje = jsonData["sxxeje"].asInt();
	}
	if (!jsonData["maxLoan"].isNull())
	{
		this->m_maxLoan = jsonData["maxLoan"].asInt();
	}
	if (!jsonData["yfSxxeje"].isNull())
	{
		this->m_yfSxxeje = jsonData["yfSxxeje"].asInt();
	}
	if (!jsonData["yfMaxLoan"].isNull())
	{
		this->m_yfMaxLoan = jsonData["yfMaxLoan"].asInt();
	}
	if (!jsonData["wfMaxLoan"].isNull())
	{
		this->m_wfMaxLoan = jsonData["wfMaxLoan"].asInt();
	}
	if (!jsonData["sbBase"].isNull())
	{
		this->m_sbBase = jsonData["sbBase"].asInt();
	}
	if (!jsonData["orderNum"].isNull())
	{
		this->m_orderNum = jsonData["orderNum"].asInt();
	}
}

